<style>
    th, th a{font-size: 10px;}
</style>
<?php $this->title = "Histórico Escolar";?>

<h3>Histórico Escolar</h3>
<h4><?php echo $this->rh['firstname'].' '.$this->rh['lastname'];?></h4>
<h5><?php echo $this->rh['cargo'];?></h5>
<br/>
<?php 
    if(count($this->cursos)):
        $ult = '';
        foreach($this->cursos as $c):
            if(!($c['perfil']==$ult)):
                if($ult){ echo '</table></div>';}
                $ult = $c['perfil'];?>
                <div class="well">
                    <h5><?php echo $c['perfil'];?></h5>
                    <table class="table table-condensed table-striped">
                        <tr>
                            <th>
                                <?php if($this->order==1):?>
                                <img style="position:relative; float:left; margin:3px 3px 0 0;" src="images/seta_abaixo.png" width="15"/>
                                <?php endif; ?>
                                <a href="rh/detalhe/id/<?php echo $this->rh['id'];?>/order/1">
                                    Título
                                </a></th>
                            <th>
                                <?php if($this->order==2):?>
                                <img style="position:relative; float:left; margin:3px 3px 0 0;" src="images/seta_abaixo.png" width="15"/>
                                <?php endif; ?>
                                <a href="rh/detalhe/id/<?php echo $this->rh['id'];?>/order/2">
                                    Dt Início
                                </a>
                            </th>
                            <th>
                                <?php if($this->order==3):?>
                                <img style="position:relative; float:left;margin:3px 3px 0 0;" src="images/seta_abaixo.png" width="15"/>
                                <?php endif; ?>
                                <a href="rh/detalhe/id/<?php echo $this->rh['id'];?>/order/3">Dt Término
                                </a>
                            </th>
                            <?php if($c['perfil']=='Participante'):?>
                            <th style="text-align: center;">Nota</th>
                            <?php endif; ?>
                        </tr>
            <?php
            endif;?>
                    <tr>
                    <td><?php echo $c['curso'];?></td>
                    <td><?php echo $this->FormataData($c['inicio']);?></td>
                    <td><?php echo $this->FormataData($c['termino']);?></td>
                    <?php if($c['perfil']=='Participante'):
                        $nota = '?';
                        foreach($this->notas as $n):
                            if($n['courseid']==$c['courseid']):
                                $nota = $this->formataNota($n['nota']);
                            endif; ?>
                        <?php endforeach; ?>
                        <td style="text-align: center;"><?php echo $nota;?></td>
                    <?php endif; ?>
                    </tr>
<?php      
    endforeach; ?>
                    </table>
                </div>
<?php endif;
?>